package gameObject.effect;

import javax.microedition.lcdui.game.LayerManager;

import base.RotatableObject;
import base.RotatableSprite;

public class Effect extends RotatableObject{
	protected int lifeTime;
	protected boolean isDetroyed=false;
	public Effect(RotatableSprite sprite,int lifeTime) {
		this.lifeTime = lifeTime;
		this.sprite = sprite;
	}
	public Effect() {
	
	}

	public boolean isDetroyed()
	{
		return isDetroyed;
	}
	public void update()
	{
		if(lifeTime>0)
		{

			sprite.nextFrame();
			lifeTime--;
			//sprite.move(5, 5);
		}else{
			isDetroyed = true;
		}
	}
	public void addTo(LayerManager layer)
	{
		layer.insert(sprite,2);
	}
}
